package tree

// https://leetcode.cn/problems/maximum-depth-of-binary-tree leetcode-104
func maxDepth(root *TreeNode) int {
	if root == nil {
		return 0
	}
	leftDepth := maxDepth(root.Left) + 1
	rightDepth := maxDepth(root.Right) + 1
	if leftDepth < rightDepth {
		return rightDepth
	}
	return leftDepth
}
